package lab02.test21;
import java.util.Scanner;
public class Test21 {

  public static void main(String[] args) {

         int i;

      int j=0;

         Scanner sc=new Scanner(System.in);

             System.out.println("请输入字符串");

            String name=sc.nextLine();

             System.out.println("请输入给定字符");

               String word=sc.nextLine();

               for (i=0;i<name.length();i++) {

                        String word2= new String(String.valueOf(name.charAt(i)));//复制字符串到word2

                        if (word.equals(word2))

                              j=j+1;//用此式判断出现次数

                            }

               System.out.println(word+"出现的频率为:"+j+"次");

           }



        }
